<template>
	<view class="details">
        <view class="box">
      <view class="list">
        <view class="list-left">学部</view>
        <view class="list-right">
          <u--input class="form-int" placeholder="请输入学部" inputAlign="right" fontSize="24rpx" color="#939393" border="none" v-model="userInfo.department"></u--input>
        </view>
      </view>
      <view class="list">
        <view class="list-left">学科</view>
        <view class="list-right">
          <u--input class="form-int" placeholder="请输入学科" inputAlign="right" fontSize="24rpx" color="#939393" border="none" v-model="userInfo.subject"></u--input>
        </view>
      </view>
           <view class="list">
        <view class="list-left">民族</view>
        <view class="list-right">
          <u--input class="form-int" placeholder="请输入民族" inputAlign="right" fontSize="24rpx" color="#939393" border="none" v-model="userInfo.nation"></u--input>
        </view>
      </view>
           <view class="list">
        <view class="list-left">身份证号</view>
        <view class="list-right">
          <u--input class="form-int" placeholder="请输入身份证号" inputAlign="right" fontSize="24rpx" color="#939393" border="none" v-model="userInfo.id_number"></u--input>
        </view>
      </view>
           <view class="list">
        <view class="list-left">出生年月</view>
        <view class="list-right">
          <u--input class="form-int" placeholder="请输入出生年月" inputAlign="right" fontSize="24rpx" color="#939393" border="none" v-model="userInfo.birth"></u--input>
        </view>
      </view>
           <view class="list">
        <view class="list-left">联系电话</view>
        <view class="list-right">
          <u--input class="form-int" placeholder="请输入联系电话" inputAlign="right" fontSize="24rpx" color="#939393" border="none" v-model="userInfo.mobile"></u--input>
        </view>
      </view>
           <view class="list">
        <view class="list-left">籍贯</view>
        <view class="list-right">
          <u--input class="form-int" placeholder="请输入籍贯" inputAlign="right" fontSize="24rpx" color="#939393" border="none" v-model="userInfo.native_place"></u--input>
        </view>
      </view>
           <view class="list">
        <view class="list-left">户贯</view>
        <view class="list-right">
          <u--input class="form-int" placeholder="请输入户贯" inputAlign="right" fontSize="24rpx" color="#939393" border="none" v-model="userInfo.registered_residence"></u--input>
        </view>
      </view>
           <view class="list">
        <view class="list-left">家庭住址</view>
        <view class="list-right">
          <u--input class="form-int" placeholder="请输入家庭住址" inputAlign="right" fontSize="24rpx" color="#939393" border="none" v-model="userInfo.home_address"></u--input>
        </view>
      </view>
          <view class="list">
        <view class="list-left">家庭状况</view>
        <view class="list-right">
          <u--input class="form-int" placeholder="请输入家庭状况" inputAlign="right" fontSize="24rpx" color="#939393" border="none" v-model="userInfo.marital_status"></u--input>
        </view>
      </view>
    </view>
    
    <view class="box">
      <view class="list">
        <view class="list-left">参加工作时间</view>
        <view class="list-right">
          <u--input class="form-int" placeholder="请输入参加工作时间" inputAlign="right" fontSize="24rpx" color="#939393" border="none" v-model="userInfo.working_time"></u--input>
        </view>
      </view>
           <view class="list">
        <view class="list-left">工龄</view>
        <view class="list-right">
          <u--input class="form-int" placeholder="请输入工龄" inputAlign="right" fontSize="24rpx" color="#939393" border="none" v-model="userInfo.working_years"></u--input>
        </view>
      </view>
           <view class="list">
        <view class="list-left">政治面貌</view>
        <view class="list-right">
          <u--input class="form-int" placeholder="请输入政治面貌" inputAlign="right" fontSize="24rpx" color="#939393" border="none" v-model="userInfo.political_face"></u--input>
        </view>
      </view>
           <view class="list">
        <view class="list-left">学历</view>
        <view class="list-right">
          <u--input class="form-int" placeholder="请输入学历" inputAlign="right" fontSize="24rpx" color="#939393" border="none" v-model="userInfo.education"></u--input>
        </view>
      </view>
           <view class="list">
        <view class="list-left">学位</view>
        <view class="list-right">
          <u--input class="form-int" placeholder="请输入学位" inputAlign="right" fontSize="24rpx" color="#939393" border="none" v-model="userInfo.academic_degree"></u--input>
        </view>
      </view>
           <view class="list">
        <view class="list-left">专业</view>
        <view class="list-right">
          <u--input class="form-int" placeholder="请输入专业" inputAlign="right" fontSize="24rpx" color="#939393" border="none" v-model="userInfo.major"></u--input>
        </view>
      </view>
           <view class="list">
        <view class="list-left">教师资格</view>
        <view class="list-right">
          <u--input class="form-int" placeholder="请输入教师资格" inputAlign="right" fontSize="24rpx" color="#939393" border="none" v-model="userInfo.qualification"></u--input>
        </view>
      </view>
           <view class="list">
        <view class="list-left">职称</view>
        <view class="list-right">
          <u--input class="form-int" placeholder="请输入职称" inputAlign="right" fontSize="24rpx" color="#939393" border="none" v-model="userInfo.title"></u--input>
        </view>
      </view>
           <view class="list">
        <view class="list-left">任教科目</view>
        <view class="list-right">
          <u--input class="form-int" placeholder="请输入任教科目" inputAlign="right" fontSize="24rpx" color="#939393" border="none" v-model="userInfo.teaching_subject"></u--input>
        </view>
      </view>
          <view class="list">
        <view class="list-left">人员分类</view>
        <view class="list-right">
          <u--input class="form-int" placeholder="请输入人员分类" inputAlign="right" fontSize="24rpx" color="#939393" border="none" v-model="userInfo.personnel_category"></u--input>
        </view>
      </view>
          <view class="list">
        <view class="list-left">第一学历</view>
        <view class="list-right">
          <u--input class="form-int" placeholder="请输入第一学历" inputAlign="right" fontSize="24rpx" color="#939393" border="none" v-model="userInfo.first_degree"></u--input>
        </view>
      </view>
           <view class="list">
        <view class="list-left">第一学历毕业院校及专业</view>
        <view class="list-right">
          <u--input class="form-int" placeholder="请输入第一学历毕业院校及专业" inputAlign="right" fontSize="24rpx" color="#939393" border="none" v-model="userInfo.first_degree_school"></u--input>
        </view>
      </view>
           <view class="list">
        <view class="list-left">最高学历</view>
        <view class="list-right">
          <u--input class="form-int" placeholder="请输入最高学历" inputAlign="right" fontSize="24rpx" color="#939393" border="none" v-model="userInfo.highest_education"></u--input>
        </view>
      </view>
           <view class="list">
        <view class="list-left">最高学历毕业院校</view>
        <view class="list-right">
          <u--input class="form-int" placeholder="请输入最高学历毕业院校" inputAlign="right" fontSize="24rpx" color="#939393" border="none" v-model="userInfo.highest_education_school"></u--input>
        </view>
      </view>
        <view class="list">
        <view class="list-left">最高学历毕业专业</view>
        <view class="list-right">
          <u--input class="form-int" placeholder="请输入最高学历毕业专业" inputAlign="right" fontSize="24rpx" color="#939393" border="none" v-model="userInfo.highest_education_major"></u--input>
        </view>
      </view>
    </view>
    <view class="box">
      <view class="list">
        <view class="list-left">深圳任教起止时间</view>
        <view class="list-right">
          <u--input class="form-int" placeholder="请输入深圳任教起止时间" inputAlign="right" fontSize="24rpx" color="#939393" border="none" v-model="userInfo.working_time_sz"></u--input>
        </view>
      </view>
           <view class="list">
        <view class="list-left">三名工程评选情况</view>
        <view class="list-right">
          <u--input class="form-int" placeholder="请输入三名工程评选情况" inputAlign="right" fontSize="24rpx" color="#939393" border="none" v-model="userInfo.three_projects"></u--input>
        </view>
      </view>
           <view class="list">
        <view class="list-left">入选未来教育家情况</view>
        <view class="list-right">
          <u--input class="form-int" placeholder="请输入入选未来教育家情况" inputAlign="right" fontSize="24rpx" color="#939393" border="none" v-model="userInfo.future_educators"></u--input>
        </view>
      </view>
           <view class="list">
        <view class="list-left">入员来源</view>
        <view class="list-right">
          <u--input class="form-int" placeholder="请输入入员来源" inputAlign="right" fontSize="24rpx" color="#939393" border="none" v-model="userInfo.personnel_source"></u--input>
        </view>
      </view>
           <view class="list">
        <view class="list-left">进入本单位时间</view>
        <view class="list-right">
          <u--input class="form-int" placeholder="请输入进入本单位时间" inputAlign="right" fontSize="24rpx" color="#939393" border="none" v-model="userInfo.entry_time"></u--input>
        </view>
      </view>
           <view class="list">
        <view class="list-left">离开本单位时间</view>
        <view class="list-right">
          <u--input class="form-int" placeholder="请输入离开本单位时间" inputAlign="right" fontSize="24rpx" color="#939393" border="none" v-model="userInfo.leave_time"></u--input>
        </view>
      </view>
           <view class="list">
        <view class="list-left">紧急联系人</view>
        <view class="list-right">
          <u--input class="form-int" placeholder="请输入紧急联系人" inputAlign="right" fontSize="24rpx" color="#939393" border="none" v-model="userInfo.emergency_contact"></u--input>
        </view>
      </view>
           <view class="list">
        <view class="list-left">紧急联系人关系</view>
        <view class="list-right">
          <u--input class="form-int" placeholder="请输入紧急联系人关系" inputAlign="right" fontSize="24rpx" color="#939393" border="none" v-model="userInfo.relationship"></u--input>
        </view>
      </view>
           <view class="list">
        <view class="list-left">紧急联系电话</view>
        <view class="list-right">
          <u--input class="form-int" placeholder="请输入紧急联系电话" inputAlign="right" fontSize="24rpx" color="#939393" border="none" v-model="userInfo.emergency_contact_mobile"></u--input>
        </view>
      </view>
      <view class="submit">
          <u-button text="提交" type="primary" @click="submit"></u-button>
      </view>
    </view>
    <u-modal 
    :show="show" 
    title="保存" 
    confirmText="确认" 
    cancelText="取消" 
    @confirm="confirm"
    @cancel="cancel"
    :showCancelButton="true" 
    ></u-modal>
	</view>
</template>

<script>
import archivesView from "../components/archivesView.vue"
import {
  editTeacher,
  teacherDetail
} from '@/api/archives.js'
	export default {
		data() {
		return {
        id:"",
        type:"1",
        userInfo:{},
        show:false,
			}
		},
    components:{
      archivesView
    },
    onLoad(option){
      this.id = option.id
      console.log(this.id)
      this.getteacherDetailFn()
    },
    methods: {
      getteacherDetailFn(){
        teacherDetail({
          id:this.id
        }).then(res=>{
          if(res.code > 0){
            this.userInfo = JSON.parse(JSON.stringify(res.data))
            // this.userInfo = res.data
          }
        })
      },
      submit(){
        console.log(this.userInfo)
        this.show = true
      },
      confirm(){
		this.dataInfo = JSON.parse(JSON.stringify(this.userInfo))
		console.log(this.dataInfo,'dataInfo')
        editTeacher({
          ...this.dataInfo
        }).then(res=>{
          if(res.code > 0){
            uni.navigateTo({
              url:"/pages/archives/index/index",
            })
          }
        })
      },
      cancel(){
        this.show = false
      },
    }
}
</script>

<style lang="less">
  .details{
    background: #f8f8f8;
  }
  .box{
    width: 100%;
    box-sizing: border-box;
    margin-top: 30rpx;
    background: #fff;
    padding: 20rpx 30rpx;
    box-sizing: border-box;
    .list{
      width: 100%;
      box-sizing: border-box;
      display: flex;
      justify-content: space-between;
      align-items: center;
      margin-top: 20rpx;
        .list-left{ 
          display: flex;
          align-items: flex-end;
          font-size: 25rpx;
          color: #939393;
          .name{
            font-size: 34rpx;
            font-weight: bold;
            color: #353437;
            margin-right: 20rpx;
          }
          .user-info{
            font-size: 26rpx;
            color:#939393;
          }
        }
      .list-right{
          font-size: 25rpx;
          color: #939393;
        .edit-pic{
          width: 30rpx;
          height: 30rpx;
          .pic{
            width: 100%;
            height: 100%;
          }
        }
      }
    }
  }
  .submit{
    margin-top: 30rpx;
  }

</style>

